<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>需求审核</title>
    <header th:replace="header::html"></header>
</head>

<body>
<div class="x-body">
    <form class="layui-form">
        <input type="hidden" id="needId" name="nid" th:value="${need.nid}">
        <div style="margin-left: 550px;margin-top: 50px">
            <div class="layui-form-item">
                <label for="L_nuseraccount" class="layui-form-label">
                    <span class="x-red">*</span>发起人
                </label>

                <div class="layui-input-inline">
                    <input type="text" id="L_nuseraccount" th:value="${need.nuseraccount}" name="nuseraccount"
                           required=""
                           lay-verify="ntitle"
                           autocomplete="off" class="layui-input" disabled=“disabled”>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_ntitle" class="layui-form-label">
                    标题：
                </label>

                <div class="layui-input-inline">
                    <input type="text" id="L_ntitle" th:value="${need.ntitle}" name="ntitle" required=""
                           lay-verify="ntitle"
                           autocomplete="off" class="layui-input" disabled=“disabled”>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_nmoney" class="layui-form-label">
                    佣金：
                </label>

                <div class="layui-input-inline">
                    <input type="text" id="L_nmoney" th:value="${need.nmoney}" name="nmoney" required=""
                           lay-verify="ntitle"
                           autocomplete="off" class="layui-input" disabled=“disabled”>
                </div>
            </div>

            <div class="layui-form-item">
                <label for="L_nrealtime" class="layui-form-label">
                    工期：
                </label>

                <div class="layui-input-inline">
                    <input type="text" id="L_nrealtime" th:value="${need.nrealtime}" name="nrealtime" required=""
                           lay-verify="ntitle"
                           autocomplete="off" class="layui-input" disabled=“disabled”>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">内容：</label>
                <div class="layui-input-block">
                <textarea style="width:500px; height:300px" placeholder="请输入内容" class="layui-textarea"
                          th:text="${need.ncontent}" disabled=“disabled”></textarea>
                </div>
            </div>

            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">要求：</label>
                <div class="layui-input-block">
                <textarea style="width:500px; height:300px" class="layui-textarea"
                          th:text="${need.ndemand}" disabled=“disabled”></textarea>
                </div>
            </div>


            <div class="layui-form-item" style="margin-left: 250px">
                <button type="button" class="layui-btn layui-btn-normal layui-btn-lg" lay-filter="pass" lay-submit="">
                    通过
                </button>
                <button type="button" class="layui-btn layui-btn-danger layui-btn-lg" lay-filter="unPass" lay-submit="">
                    回绝
                </button>
            </div>
        </div>
    </form>
</div>
<script>
	layui.use(['form', 'layer', 'laydate'], function () {
		$ = layui.jquery;
		var form = layui.form
			, layer = layui.layer
			, laydate = layui.laydate;

		//监听提交
		form.on('submit(pass)', function (data) {
			$.ajax({
				url: "/api-back/need/passVerify",
				type: "POST",
				data: data.field,
				dataType: 'json',
				success: function (result) {
					if (result.code == 500 || result.code == 5000100 || result.code == 5000101 || result.code == 5000102) {
						layer.alert(result.msg);
					} else {
						layer.alert("审核成功", {icon: 6}, function () {
							//关闭当前frame
							xadmin.close();
							// 可以对父窗口进行刷新
							xadmin.father_reload();
						});
					}
				}
			});
			return false;
		});

		//监听提交
		form.on('submit(unPass)', function (data) {
			$.ajax({
				url: "/api-back/need/unPassVerify",
				type: "POST",
				data: data.field,
				dataType: 'json',
				success: function (result) {
					if (result.code == 500 || result.code == 5000100 || result.code == 5000101 || result.code == 5000102) {
						layer.alert(result.msg);
					} else {
						layer.alert("审核成功", {icon: 6}, function () {
							//关闭当前frame
							xadmin.close();
							// 可以对父窗口进行刷新
							xadmin.father_reload();
						});
					}
				}
			});
			return false;
		});
	});
</script>
</body>
</html>